package com.wanxi.servlet;

import com.wanxi.model.CompanyModel;
import com.wanxi.model.NavModel;
import com.wanxi.service.CompanyService;
import com.wanxi.service.NavService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

public class CommonServlet {
    public static void getCompanyData(HttpServletRequest req, HttpServletResponse resp) {

        //        取得公司信息
        CompanyModel companyModel = new CompanyModel();
        CompanyService companyService = new CompanyService();
        companyModel = companyService.getCompanyModel();
//        取得导航信息
        List<NavModel> navModelList = new ArrayList<>();
        NavService navService = new NavService();
        navModelList = navService.getNavModelList();

        req.setAttribute("companyModel", companyModel);
        req.setAttribute("navModelList", navModelList);
    }
}
